package com.md.tw.mapper;

import com.md.tw.entity.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface StudentMapper {

    @Select("select id stuId, stu_name stuName, stu_age stuAge, stu_gener stuGender from student")
    List<Student> getAllStudents();

    @Select("select id stuId, stu_name stuName, stu_age stuAge, stu_gener stuGender from student where id = #{id}")
    Student getStudentById(int id);

    @Delete("delete from student where id = #{id}")
    int deleteStudent(int id);

    @Insert("insert into student (stu_name, stu_age, stu_gender) values (#{student})")
    int insertStudent(Student student);

    @Update("update studnt set stu_name = #{stuName} where id = #{stuId}")
    int updateStudent(Student student);

}
